package com.admin.system.modules.system.dto;

import com.admin.core.entity.SysMenu;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * 菜单树dto
 *
 * @author sq-lan
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class MenuTreeDTO extends SysMenu {


    @TableField(exist = false)
    private List<MenuTreeDTO> children;

    public Boolean getHasChildren() {
        return getSubCount() != null && getSubCount() > 0;
    }

    public Boolean getLeaf() {
        return getSubCount() != null && getSubCount() <= 0;
    }

    public String getLabel() {
        return getTitle();
    }

}
